<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>ModbusPal</title>
    <link rel="stylesheet" type="text/css" href="styles.css" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>

      <h1>Editing an automation</h1>

      <p>
      <img src="img/view_of_automation_editor.jpg" class="img-stand-alone" title="Automation editor" alt="View of the automation editor"/>
      The automation editor is made of the following elements:</p>

      <dl>
          <dt>Add generators</dt><dd>A list of buttons to add generators in
          the current automation. It also contain a button to summon
          the script manager dialog, because the user can create custom
          generators by using scripts.</dd>
          <dt>Global settings</dt><dd>Defines the initial value generated by
          the automation, and the sampling rate (“Step”, in seconds).</dd>
          <dt>Controls</dt><dd>Buttons to control the execution of the automation.</dd>
          <dt>Value</dt><dd>A real-time visualization of the current value of the automation.</dd>
      </dl>

      <h2>Global settings</h2>

      <h3>Initial value</h3>

      <p>The <q>Init</q> field is a floating point value that specifies the
      initial value of the automation.</p>
      
      <h3>Sampling rate</h3>
              
      <p>The <q>Step</q> is a value in seconds, which defines the duration
      between two updates of the value generated by the automation. The smaller
      the step is, the higher the refresh rate of the value.</p>

      <h3>Loop</h3>
      
      <p>The <q>Loop</q> toggle button determines, when the automation ends,
      if it should restarts automatically from the beginning.</p>

      <h2>Adding a generator</h2>

      <p>A generator is added into the automation by clicking on the
      appropriate button in the <q>Add generators</q> panel. Each button
      represents a class of generator.</p>

      <p>The user can add his/her own custom generators by creating scripts.
      Clicking on the <q>...</q> button will summon the Script Dialog.</p>
      
      <p>The new generator is always added at the end of the list.</p>
      
      <p>A generator looks like this:
     <img src="img/advanced_generator_screenshot.jpg" class="img-stand-alone" title="Custom generator" alt="A generator" />
      Every generator contains an icon on the left, some buttons and settings
      on the right. It may contain additional settings in the middle (the
      editable value of <q>A</q> in the abova example), which are specific to
      each type of generator.</p>

      <h3>Duration of generators</h3>

      <p>Each generator is executed for a determined amount of time, called
          <q>duration</q>, and then the automation goes on with the next
          generator in the list. The duration is configured by typing the
          desired number of seconds (decimal values are supported, but check
          that the <q>Step</q> value of the automation has sufficient granularity)
          in the <q>Duration</q> input box of each generator in the list.</p>

      <h3>Changing the order of execution</h3>

      <p>The generators are executed one after the other, starting from the top
          of the list and finishing at the bottom.</p>
      
      <p>The order of execution of the generators can be changed by swapping them,
          using the <q>Up</q> and <q>Down</q> buttons. Clicking on <q>Up</q>
          will swap the current generator with the one directly above.
        Clinking on <q>Down</q> will swap the current generator with the one
        directly below.</p>

      <h3>Deleting a generator</h3>

      <p>Clicking on the <q>Delete</q> button will remove a generator from
          the current automation.</p>

      <h2>Controls</h2>

      <h3>Start and stop</h3>
      
      <p>An automation can be started by clicking on the
      <q>Play</q> button. Then it can be paused by clicking on the <q>Pause</q>
      button, and resumed by clicking on the <q>Play</q> button again.</p>

      <p>The automation will stop on its own when the last generator is ended
          (unless the <q>Loop</q> option enabled). But it can be stopped at any
          time by clicking on the <q>Stop</q> button</p>.

      <h3>Loop</h3>

      <p>When an automation starts, it executes each generator one by one
      during the specified amount of time. When the execution of the last
      generator is finished, the automation ends, and the generated value is
      no more updated, unless the <q>Loop</q> option is enabled.</p>
      
      <p>If the <q>Loop</q> option is enabled, then the execution of the
          automation continues infinitely by restarting the whole generators sequence.</p>

      <div class="notes">
          <h4>Notes</h4>
          <ul>
              <li><q>Loop</q> is enabled by default.
              <li>The internal counter that keeps track of elapsed time is not
                  resetted when the sequence restarts.
          </ul>
      </div>

      <h2>Generators</h2>

          <p>Check the following pages for a description of the built-in generators:</p>
          <ul>
            <li><a href="linear-generator.html">Linear generator</a>
            <li><a href="random-generator.html">Random generator</a>
            <li><a href="sine-generator.html">Sine generator</a>
          </ul>

      <h2>Bindings</h2>

      <p>Check
      <a href="bindings-overview.html">this page</a>
      to learn how to associate an automation to registers/coils.</p>
  </body>
</html>
